import axios from '@/libs/api.request.js'

let api = "access";

export const getPermissionList = data => {
    return axios.request({
        url:`permission/getPermissionList`,
        method:'post',
        data:data
    });
};

export const savePermission = data => {
    return axios.request({
        method:"post",
        url:`permission/savePermission`,
        data:data
    });
};

export const updatePermission = data => {
    return axios.request({
        method:"post",
        url:`permission/updatePermission`,
        data:data
    });
};

export const saveOrUpdate = data => {
    return data.id ? updatePermission(data) : savePermission(data);
};

export const removePermission = data => {
    return axios.request({
        method:'get',
        data:null,
        url:`permission/removePermission/${data.id}`
    });
};

export const getPermissionsByRoleId = data => {
    return axios.request({
        method:'get',
        data:null,
        url:`permission/getPermissionsByRoleId/${data.id}`
    });
};